#include <iostream>
#include <map>
using namespace std;
#define ll long long

int n,m;
map<ll,ll> ma;

signed main()
{
    cin>>n>>m;
    for(int i=0;i<m;i++){
        for(int j=0;j<n;j++){
            ll a;
            cin>>a;
            ma[a]++;
        }
    }
    ll maxa = 0,maxNum = 0;
    for(auto it:ma){
        if(it.second>maxNum){
            maxa = it.first;
            maxNum = it.second;
        }
    }
    cout<<maxa;
    return 0;
}
